package com.huage.courseplatform.application.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huage.courseplatform.application.model.entity.Business;
import com.huage.courseplatform.application.model.entity.SysConfig;
import com.huage.courseplatform.application.model.entity.Teacher;
import com.huage.courseplatform.application.model.vo.BusinessTeacherFlowRecordVO;
import com.huage.courseplatform.framework.config.MybatisRedisCache;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
//@CacheNamespace(implementation= MybatisRedisCache.class,eviction= MybatisRedisCache.class)
public interface BusinessMapper extends BaseMapper<Business> {

    List<Business> getBusinessListByUserId(String userId);

    //根据商家ID查询绑定用户
    List<String> getUserIdListById(String id);

    //根据商家ID联查申请记录
    List<BusinessTeacherFlowRecordVO> getTeacherApplyList(String id);

    //获取附近多少米的商户
    List<Business> getBusinessByLocation(@Param("longitude") Double longitude,
                                         @Param("latitude") Double latitude,
                                         @Param("distance") Integer distance);

    /*
        中间表 UserBusiness
    */
    int insertUserBusinessById(@Param("userId") String userId, @Param("businessId") String businessId);

    int delUserBusinessById(@Param("userId") String userId, @Param("businessId") String businessId);
}
